package com.yyaccp.appinfo.service;

import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Appinfo;
import com.yyaccp.appinfo.domain.AppInfo;
import com.yyaccp.appinfo.mapper.AppInfoMapper;
import com.yyaccp.appinfo.utils.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 天天向上 （john.yi@qq.com）
 * @date 2020/11/23.
 */
@Service
public class AppInfoService {
    @Autowired
    private AppInfoMapper appInfoMapper;

    public void search(AppInfo appInfo, PageBean pageBean) {
        // 设置总记录数和总页数
        int total = appInfoMapper.getCount(appInfo);
        pageBean.setTotal(total);
        // 设置分页的集合
        List<Appinfo> dataList = appInfoMapper.search(appInfo,
                (pageBean.getPageNo() - 1) * pageBean.getPageSize(), pageBean.getPageSize());
        pageBean.setDataList(dataList);
    }
}
